package com.med.controller;

import com.med.config.VisitControllerFeign;
import com.med.service.IVisitService;
import com.med.vo.MedicalRecordVO;
import com.med.vo.MedicineOrderVO;
import com.med.vo.MedicineVO;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.prefs.BackingStoreException;

/**
 * Project:internet-based-healthcare
 * Package:com.med.controller
 *
 * @Description:
 * @Author:其一
 * @CreateTime: 2025-08-23-13-48
 */
@RestController
@RequestMapping("/visit")
public class VisitController extends BaseController {
    @Autowired
    private VisitControllerFeign visitControllerFeign;
    @Autowired
    private IVisitService visitService;

    @RequestMapping("/query")
    public TableDataInfo selectMedicalRecord(Integer userId) {
        return getDataTable(visitService.selectMedicalRecord(userId));
    }

    @RequestMapping("/queryname")
    public TableDataInfo selectUserMessage(String userName) {
        return getDataTable(visitService.selectUserMessage(userName));
    }

    @RequestMapping("/insert")
    public AjaxResult insertMedicalRecord(MedicalRecordVO medicalRecordVO) {
        return toAjax(visitService.insertMedicalRecord(medicalRecordVO));
    }

    @RequestMapping("/list")
    public String test(@SpringQueryMap MedicineVO medicineVO) {
        return visitControllerFeign.test(medicineVO);
    }

    @RequestMapping("/medicineOrder")
    public AjaxResult createMedicineOrder(MedicineOrderVO medicineOrderVO) {
        System.out.println("---------------------------------------------------------");
        System.out.println(medicineOrderVO);
        return toAjax(visitService.createMedicineOrder(medicineOrderVO));
    }
}
